package xin.baizhiedu.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xin.baizhiedu.entity.QGdataList;
import xin.baizhiedu.mapper.QgWorkScenceMapper;
import xin.baizhiedu.service.QgWorkScenceService;

import java.util.HashMap;
import java.util.Map;

@Service
@Transactional(rollbackFor = Exception.class)
public class QgWorkScenceServiceImpl implements QgWorkScenceService {

    @Autowired
    QgWorkScenceMapper qgWorkScenceMapper;
    @Override
    public Map<String,Object> searchWorkOrderFlow() {
        Map<String,Object> map =qgWorkScenceMapper.searchWorkOrderFlowOther();
        map.put("HL",qgWorkScenceMapper.searchWorkOrderFlowHL());
        return map;
    }

    @Override
    public Map<String,Object> searchWorkCenter() {
        Map<String,Object> map = new HashMap();
        map.put("dataInfo",qgWorkScenceMapper.searchWorkCenterTotal());
        map.put("dataList",qgWorkScenceMapper.searchWorkCenterTable());
        return map;
    }

    @Override
    public QGdataList searchWorkOrderCompletion() {
        QGdataList map = new QGdataList();
        map.setDataList(qgWorkScenceMapper.searchWorkOrderCompletionTable());
        map.setAssembleRatio(qgWorkScenceMapper.searchWorkOrderCompletionTotal().get("assembleRatio").toString());
        map.setTestRatio(qgWorkScenceMapper.searchWorkOrderCompletionTotal().get("testRatio").toString());
        map.setRepairRatio( qgWorkScenceMapper.searchWorkOrderCompletionTotal().get("repairRatio").toString());
        map.setCheckoutRatio( qgWorkScenceMapper.searchWorkOrderCompletionTotal().get("checkoutRatio").toString());
        map.setPackageRatio(qgWorkScenceMapper.searchWorkOrderCompletionTotal().get("packageRatio").toString());
        map.setCompleteRatio(qgWorkScenceMapper.searchWorkOrderCompletionCompleteRatio());
        map.setMeritRatio(qgWorkScenceMapper.searchWorkOrderCompletionMeritRatio());
        return map;
    }

}
